module.exports = {
  router: {
    linkActiveClass: 'active',
    extendRoutes(routes, resolve) {
      // console.log(routes); // 这里是自动生成的路由表
      routes.length = 0; // 清除基于pages目录默认生成的路由表
      routes.push(...[
        {
          path: '/',
          component: resolve(__dirname, 'pages/layout'),
          children: [
            {
              path: '',
              name: 'home',
              component: resolve(__dirname, 'pages/home'),
            },
            {
              path: '/login',
              name: 'login',
              component: resolve(__dirname, 'pages/login')
            },
            {
              path: '/register',
              name: 'register',
              component: resolve(__dirname, 'pages/login')
            },
            {
              path: '/profile/:username',
              name: 'profile',
              component: resolve(__dirname, 'pages/profile')
            },
            {
              path: '/setting',
              name: 'setting',
              component: resolve(__dirname, 'pages/setting')
            },
            {
              path: '/create',
              name: 'create',
              component: resolve(__dirname, 'pages/create')
            },
            {
              path: '/edit/:slug',
              name: 'edit',
              component: resolve(__dirname, 'pages/create')
            },
            {
              path: '/article/:slug',
              name: 'article',
              component: resolve(__dirname, 'pages/article')
            }
          ]
        },
      ]);
    }
  },
  // 注册插件
  plugins: [
    '~/plugins/request.js',
    '~/plugins/date.js',
  ],
  server: {
    host: '0.0.0.0',
    port: 5050
  }
}